// promise 形式的getSetting
export const getSetting = () => {
    return new Promise((resolve, reject) => {
        wx.getSetting({
            success: (result) => {
                resolve(result)
            },
            fail: (err) => { reject(err) },

        });

    })
}

// promise chooseAddress
export const chooseAddress = () => {
    return new Promise((resolve, reject) => {
        wx.chooseAddress({
            success: (result) => {
                resolve(result)
            },
            fail: (err) => { reject(err) },
        });

    })
}
// promise openSetting
export const openSetting = () => {
    return new Promise((resolve, reject) => {
        wx.openSetting({
            success: (result) => {
                resolve(result)
            },
            fail: (err) => { reject(err) },
        });

    })
}
// 弹框询问
// 传入的对象也可以使用解构的方式
export const showModal = ({ content }) => {
    return new Promise((resolve, reject) => {
        wx.showModal({
            title: '提示',
            content: content,
            success: (res) => {
                resolve(res)
            }
        })

    })
}
// 弹出提示框
export const showToast = ({ title, icon }) => {
    return new Promise((resolve, reject) => {
        wx.showToast({
            title: title,
            icon: icon,
            success: (result) => {
                resolve(result)
            }
        })
    })

}
// 登陆
export const login = () => {
    return new Promise((resolve, reject) => {
        wx.login({
            timeout: 10000,
            success: (result) => {
                resolve(result)
            },
            fail: (err) => reject(err)
        });

    })

}
